home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3562 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Undefined behavior? on type conversion, was: Re: Hungarian notation
  5. Date: Mon, 29 Jan 96 23:23:00 GMT
  6. Organization: none
  7. Message-ID: <822957780snz@genesis.demon.co.uk>
  8. References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <KANZE.96Jan24152858@slsvewt.lts.sel.alcatel.de>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <KANZE.96Jan24152858@slsvewt.lts.sel.alcatel.de>
  15.            kanze@lts.sel.alcatel.de "James Kanze US/ESC 60/3/141 #40763" writes:
  16.  
  17. (Newsgroups trimmed)
  18.  
  19. >Does it?  I believe that it was the intent of the authors that the
  20. >`result' of the conversion could be a signal (for example) or a core
  21. >dump.
  22.  
  23. I disagree!
  24.  
  25. > (This is, of course, the only reasonable thing for an
  26. >implementation to do.)
  27.  
  28. Possibly but existing practice won out here. The normal approach is for the
  29. compiler to pick ot the relevant low order bits and ignore the higher order
  30. ones. That also has the effect of preserving value in a
  31. signed->unsigned->signed conversion although the standard gives no guarantees
  32. about this which leaves a problem with char handling: can you portably assign
  33. the return value of getchar() (non-EOF values can be represented in an
  34. unsigned char) to a char which may be signed?
  35.  
  36. -- 
  37. -----------------------------------------
  38. Lawrence Kirby | fred@genesis.demon.co.uk
  39. Wilts, England | 70734.126@compuserve.com
  40. -----------------------------------------
  41.